home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / backup / dds2tar-.000 / dds2tar-2.4.12.tar / dds2tar-2.4.12 / ddstool < prev    next >
Text File  |  1995-02-05  |  2KB  |  88 lines

  1. #!/bin/sh
  2. # This tool is in experimental status.
  3. #
  4. # Send me an email, if you have nice ideas.
  5. #                  weule@uni-duesseldorf.de
  6. #
  7. #====================================================================
  8. # Usage:
  9. #
  10. # First label a tape:
  11. #     ddstool create-label 'unique-string and more strings'
  12. #
  13. # To archive something:
  14. #     ddstool append pathnames...
  15. #
  16. # To delete the old index-files and make a new label:
  17. #     ddstool new-label 'unique-string and more strings'
  18. #
  19. # Each index is stored by the pathnames:
  20. #     $A/$unique-string.$file-number              (soft link)
  21. #     $A/$timestamp-of-the-tapelabel.$file-number (file)
  22. #
  23. #====================================================================
  24. # Sorry that I don't know the right method to extract something.
  25. # For now it's more save to do it by hand.
  26. #
  27. #====================================================================
  28. #
  29. set -v
  30. A=/data/tape
  31. case "$1" in
  32. append)
  33.     mt rewind;
  34.     L=`mt-dds label | awk '{print $1}' `
  35.     T=`mt-dds ts`
  36.     mt rewind
  37.     mt eom
  38.     mt status | grep file
  39.     F=`mt status | awk '{ if ($1 == "file") printf("%02d",$4) }'`
  40.     echo $A/$T.$F $A/$L.$F
  41.     touch $A/$T.$F
  42.     ln -f -s $A/$T.$F $A/$L.$F
  43.     shift
  44.     tar --label "$L" -b 32 -R -v -v --record-file $A/$T.$F --create $*
  45. ;;
  46. create-label)
  47.     mt rewind
  48.     tar --create --label "$2" -b 2
  49. ;;
  50. new-label)
  51.     mt rewind;
  52.     L=`mt-dds label | awk '{print $1}' `
  53.     T=`mt-dds ts`
  54.     mt rewind
  55.     rm $A/$L.* $A/$T.*
  56.     L=`echo "$2" | awk '{print $1}'`
  57.     if test -f $L.01 ; then
  58.         echo $0: ERROR: Label ist schon bekannt!
  59.     else
  60.         tar --create --label "$2" -b 2
  61.         mt rewind
  62.         T=`mt-dds ts`
  63.         F=00
  64.         tar -b 1 -t -v -v -R --record-file $A/$T.$F
  65.         ln -f -s $A/$T.$F $A/$L.$F
  66.     fi
  67. ;;
  68. index)
  69.     mt rewind;
  70.     L=`mt-dds label | awk '{print $1}' `
  71.     T=`mt-dds ts`
  72.     mt rewind
  73.     B=`mt-dds blksize`
  74.     echo $B
  75.     tar -v -v -R -t -b $B --record-file $A/$T.$F
  76.     mt rewind
  77.     mt asf "$2"
  78.     F=`mt status | awk '{ if ($1 == "file") printf("%02d",$4) }'`
  79.     echo File = $F
  80.     echo $A/$T.$F $A/$L.$F
  81.     touch $A/$T.$F
  82.     ln -f -s $A/$T.$F $A/$L.$F
  83.     B=`mt-dds blksize`
  84.     echo Blksize = $B
  85.     tar -b $B -t -R -v -v --record-file $A/$T.$F
  86. esac
  87. mt rewind
  88.